enum MusicSource {
  mitu('mitu', '米兔音乐'),
  buguyy('buguyy', '布谷音乐'),
  joox('joox', 'JOOX'),
  netease('netease', '网易云音乐'),
  kuwo('kuwo', '酷我音乐'),
  tencent('tencent', 'QQ音乐'),
  migu('migu', '咪咕音乐'),
  kugou('kugou', '酷狗音乐'),
  ximalaya('ximalaya', '喜马拉雅'),
  tidal('tidal', 'Tidal'),
  spotify('spotify', 'Spotify'),
  ytmusic('ytmusic', 'YouTube Music'),
  qobuz('qobuz', 'Qobuz'),
  deezer('deezer', 'Deezer'),
  alger('alger', 'Alger'),
  apple('apple', 'Apple Music');

  const MusicSource(this.value, this.displayName);

  final String value;
  final String displayName;

  static MusicSource fromString(String value) {
    return MusicSource.values.firstWhere(
      (source) => source.value == value,
      orElse: () => MusicSource.netease,
    );
  }
}

enum AudioQuality {
  low(128, '标准', 'low'),
  medium(192, '较高', 'medium'),
  high(320, '极高', 'high'),
  lossless(740, '无损', 'lossless'),
  hires(999, 'Hi-Res', 'hires');

  const AudioQuality(this.bitrate, this.displayName, this.value);

  final int bitrate;
  final String displayName;
  final String value;

  static AudioQuality fromString(String value) {
    return AudioQuality.values.firstWhere(
      (quality) => quality.value == value,
      orElse: () => AudioQuality.high,
    );
  }

  // 为了向后兼容，添加standard别名
  static AudioQuality get standard => AudioQuality.high;
}
